package com.feini.ktv.svc.config;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

import javax.sql.DataSource;

/**
 * @author zym
 * @date 2021/4/21 16:05
 */
@Configuration
@MapperScan(basePackages = "com.feini.**.mapper", sqlSessionTemplateRef = "sqlSessionTemplate")
public class DatabaseConfig {

    @Bean
    @Primary
    @ConfigurationProperties("spring.datasource.ktv")
    public DataSource ktv() {
        return DataSourceBuilder.create().build();
    }

}